package com.pets.web.entity;

import java.math.BigDecimal;

import cn.hutool.json.JSONArray;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.pets.web.config.CDNUrlsJsonSerializer;
import com.pets.web.config.JsonArrayToStringHandler;
import com.pets.web.config.RichTextJsonSerializer;
import com.pets.web.enums.GoodEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 商品表
 * </p>
 *
 * @author zhurenwang
 * @since 2024-05-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("pets_goods")
@ApiModel(value="PetsGoods对象", description="商品表")
public class PetsGoods implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "店铺id")
    private Integer shopId;

    @ApiModelProperty(value = "商品名称")
    private String name;

    @ApiModelProperty(value = "商品主图")
    private String mainImage;

    @ApiModelProperty(value = "价格/Kg")
    private BigDecimal price;

    @ApiModelProperty(value = "价格模版")
    @TableField(typeHandler = JsonArrayToStringHandler.class)
    private JSONArray priceTemplate;

    @ApiModelProperty(value = "默认选中的价格模版索引")
    private Integer selectIndex;

    @ApiModelProperty(value = "助力文案")
    private String assist;

    @ApiModelProperty(value = "目标")
    private Integer target;

    @ApiModelProperty(value = "轮播图")
    //@JsonSerialize(using = CDNUrlsJsonSerializer.class)
    private String banner;

    @ApiModelProperty(value = "产品参数")
    @TableField(typeHandler = JsonArrayToStringHandler.class)
    private JSONArray param;

    @ApiModelProperty(value = "商品保证")
    @TableField(typeHandler = JsonArrayToStringHandler.class)
    private JSONArray ensure;

    @ApiModelProperty(value = "授权文案")
    private String authText;

    @ApiModelProperty(value = "授权图片")
    //@JsonSerialize(using = CDNUrlsJsonSerializer.class)
    private String authPics;

    @ApiModelProperty(value = "折扣文案")
    private String discounts;

    @ApiModelProperty(value = "商品介绍")
    //@JsonSerialize(using = RichTextJsonSerializer.class)
    private String intro;

    @ApiModelProperty(value = "状态 0-上架 1-下架")
    private GoodEnums status;

    @ApiModelProperty(value = "收货人")
    private String receiver;

    @ApiModelProperty(value = "收货地址")
    private String address;

    @ApiModelProperty(value = "系统用户id")
    private Long sysUserId;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private String shopName;

    @TableField(exist = false)
    private String shopAvatar;

}
